from qiniu import Auth, put_data


access_key = "05TywiIT8wToSU_D-BrhjzclpFt9c0D5bw1_x0hd"
secret_key = "oqUM6ztanScL72li-03LWNuwhNk9aHtXkqv8rU_T"
bucket_name = "heiha"




def storage(data):
    try:
        q = Auth(access_key, secret_key)
        token = q.upload_token(bucket_name)
        ret, info = put_data(token, None, data)
        print(ret, info)
    except Exception as e:
        raise e;


    if info.status_code != 200:
        raise Exception("上传图片失败")
    return ret["key"]